fn_addOrEdit=(ctx)=>{

    let id = ctx.request.body.newId
    let title = ctx.request.body.newTitle
    let thing1 = ctx.request.body.newThing1
    let thing2 = ctx.request.body.newThing2 
    let thing3 = ctx.request.body.newThing3 
    let author = ctx.request.body.newAuthor 
    let time = ctx.request.body.newTime 
    
    

    if (id!==undefined) {
        let html =
        `
        <div id="add">
            <table>
                <tr hidden>
                    <td>id：</td>
                    <td>
                        <input type="text" name="id" value="${id}">
                    </td>
                </tr>
                <tr>
                <td>标题：</td>
                <td>
                    <input type="text" name="title" value="${title}">
                </td>
            </tr>
            <tr>
                <td>摘要：</td>
                <td>
                    <input type="text" name="thing1" value="${thing1}">
                </td>
            </tr>
            <tr>
                <td>内容：</td>
                <td>
                    <input type="text" name="thing2" value="${thing2}">
                </td>
            </tr>
            <tr>
                <td>分类：</td>
                <td>
                    <input type="text" name="thing3" value="${thing3}">
                </td>
            </tr>
            <tr>
                <td>作者：</td>
                <td>
                    <input type="text" name="author" value="${author}">
                </td>
            </tr>
            <tr>
                <td>发表时间：</td>
                <td>
                    <input type="text" name="time" value="${time}">
                </td>
            </tr>
           
                <tr>
                    <td>
                        <input type="button" value="保存" onclick="save(${id})">
                    </td>
                    <td>
                        <input type="button" value="取消" onclick="cancel()">
                    </td>
                </tr>
            </table>
        </div>
        `
        ctx.body=html
    }else{
        let html =
        `
        <div id="add">
            <table>
                <tr hidden>
                    <td>id：</td>
                    <td>
                        <input type="text" name="id">
                    </td>
                </tr>
                <tr>
                    <td>标题：</td>title
                    <td>
                        <input type="text" name="title">
                    </td>
                </tr>
                <tr>
                    <td>摘要：</td>
                    <td>
                        <input type="text" name="thing1">
                    </td>
                </tr>
                <tr>
                    <td>内容：</td>
                    <td>
                        <input type="text" name="thing2">
                    </td>
                </tr>
                <tr>
                    <td>分类：</td>
                    <td>
                        <input type="text" name="thing3">
                    </td>
                </tr>
                <tr>
                    <td>作者：</td>
                    <td>
                        <input type="text" name="author">
                    </td>
                </tr>
                <tr>
                    <td>时间：</td>
                    <td>
                        <input type="text" name="time">
                    </td>
                </tr>
                <tr>
                    <td>
                        <input type="button" value="保存" onclick="save(${''})">
                    </td>
                    <td>
                        <input type="button" value="取消" onclick="cancel()">
                    </td>
                </tr>
            </table>
        </div>
        `
        ctx.body=html
    }

}
let get = [['/addhtml',fn_addOrEdit]]
let post = [['/addhtml',fn_addOrEdit]]
module.exports={
    "GET":get,
    "POST":post
}